#include <ros/ros.h>
#include <nodelet/nodelet.h>
#include <pluginlib/class_list_macros.h>
#include <gstcamera/gstcamera_nodelet.h>

PLUGINLIB_DECLARE_CLASS(gstcamera,GstcamNodelet,gstcamera::GstcamNodelet,nodelet::Nodelet)
//每个Plugin都需要由一个插件描述文件


namespace gstcamera {
  GstcamNodelet::GstcamNodelet() :
    nodelet::Nodelet(),
    gstcam_driver_(NULL),
    stream_thread_(NULL)
  {
  }

  GstcamNodelet::~GstcamNodelet() 
  {
    stream_thread_->join();
  }

  void GstcamNodelet::onInit()
  {
    gstcam_driver_.reset(new gstcamera::Gstcamera(this->getNodeHandle(), this->getPrivateNodeHandle()));
    stream_thread_.reset(new boost::thread(boost::bind(&Gstcamera::run, gstcam_driver_.get())));
  }
}
